<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:ui="http://java.sun.com/jsf/facelets"
      template="/resources/template/template.xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/resources/template/template.xhtml">

        <ui:define name="content">


            <h:panelGroup  rendered="#{!webUserController.hasPrivilege('AdminManagingUsers')}" >
                <p:outputLabel value="YOU ARE NOT AUTHERIZED" ></p:outputLabel>
            </h:panelGroup>

            <h:panelGroup  rendered="#{webUserController.hasPrivilege('AdminManagingUsers')}" >
                <h:form>
                    <p:panel header="Change Password" >
                        <f:facet name="header" >
                            <p:outputLabel value="Change Password" ></p:outputLabel>
                            <p:commandButton ajax="false" value="Back" style="float: right;" action="#{webUserController.backToViewUsers()}" ></p:commandButton>
                        </f:facet>
                        <p:growl />
                        <p:panelGrid columns="2" >
                            <p:outputLabel  value="Name" ></p:outputLabel>
                            <p:outputLabel  value="#{webUserController.current.webUserPerson.name}" ></p:outputLabel>
                            <p:outputLabel  value="User Name" ></p:outputLabel>
                            <p:outputLabel  value="#{webUserController.current.name}" ></p:outputLabel>
                            <h:outputLabel value="New Password"/>
                            <h:inputSecret  value="#{webUserController.newPassword}"/>
                            <h:outputLabel value="Re-enter new Password"/>
                            <h:inputSecret   value="#{webUserController.newPasswordConfirm}"/>
                            <p:defaultCommand target="btnChangePassword"/>
                            <p:commandButton id="btnChangePassword" ajax="false" value="Change Password" 
                                             action="#{webUserController.changeCurrentUserPassword}" 
                                             onclick="onSubmitButton();"/>
                        </p:panelGrid>
                    </p:panel>
                </h:form>
            </h:panelGroup>
        </ui:define>

    </ui:composition>
</html>
